﻿using System;
using System.Collections;
using System.Web.UI;
using System.Web.UI.WebControls;
using Library;

namespace DirectoryWeb
{
  /// <summary>
  /// ユーザーリスト画面のフォームです。
  /// </summary>
  public partial class UserList : Page
  {
    #region イベントハンドラ
    protected void UsersDataSource_Selected(object sender, ObjectDataSourceStatusEventArgs e)
    {
      this.CountLabel.Text = String.Format("{0} 個のオブジェクト", ((ICollection)e.ReturnValue).Count);
    }

    protected void DataSource_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
    {
      if (this.UserListBox.SelectedIndex == -1)
      {
        e.Cancel = true;
      }
    }

    protected void UserListBox_SelectedIndexChanged(object sender, EventArgs e)
    {
      if (this.UserListBox.SelectedIndex >= 0)
      {
        this.GroupButton.OnClientClick = String.Format(
          "showInRoleGroupList('{0}', '{1}')", this.UserListBox.SelectedValue, CategoryType.User);
        this.GroupButton.Enabled = true;
        this.GroupUpdatePanel.Update();
      }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
      Response.Redirect("Main.aspx");
    }
    #endregion
  }
}